home *** CD-ROM | disk | FTP | other *** search
- procedure capture_on;
- begin
- check_if_in_help;
- prompt_color;
- capture_file_name := 'CAPTURE.TMP';
- Set_PickWindow_To(10,5,25,22,SingleLine,'Files');
- SayGet(20,status_line,'Capture File (or ?) ',capture_file_name,_S,24,1);
- WatchKeys := ['?'];
- ReadGets;
- if LastKey = '?' then capture_file_name := PickFile('*.*');
- if (capture_file_name <> '')
- then
- begin
- assign(capture_file,capture_file_name);
- {$I-}
- rewrite(capture_file);
- if (IOresult <> 0)
- then begin
- gotoxy(20,status_line); status_color;
- write('Unable to open ',capture_file_name,^G^G^G);
- delay(1000);
- close(capture_file);
- end;
- capture := TRUE;
- sho_status;
- end;
- end;
-
- procedure capture_off;
- begin
- writeln(capture_file, rcv_buffer[buf_cnt]^);
- close(capture_file);
- capture := FALSE;
- sho_status;
- end;
-
- procedure init_rcv_buffers;
- var i : integer;
- begin
- for i := 1 to max_rcv_buffers do
- rcv_buffer[i]^[0] := chr(0);
- rcv_cnt := 0;
- buf_cnt := 1;
- end;
-
- procedure update_buffer(c : char);
- var i : integer;
- begin
- if c <> #13 then
- begin
- inc(rcv_cnt);
- rcv_buffer[buf_cnt]^[rcv_cnt] := c;
- rcv_buffer[buf_cnt]^[0] := chr(rcv_cnt);
- end
- else
- begin
- if (capture = TRUE) then writeln(capture_file,rcv_buffer[buf_cnt]^);
- inc(buf_cnt);
- if (buf_cnt > max_rcv_buffers) then buf_cnt := 1;
- rcv_cnt := 0;
- rcv_buffer[buf_cnt]^[0] := chr(rcv_cnt);
- end;
- end;
-
- procedure next_line;
- begin
- if yin = inp_end_line
- then begin
- window(1, inp_start_line, 80, inp_end_line );
- gotoxy(1,1); DelLine;
- full_window;
- xin := 1;
- gotoxy(xin,yin);
- end
- else begin
- yin := yin + 1;
- xin := 1;
- gotoxy(xin,yin);
- end;
- end;
-
- procedure show_inp(st: char);
- var i,n,p: integer;
- begin
- if st = #00 then exit;
- receive_color;
- if (rcv_cnt = 80) then
- case st of
- '!'..'z': begin
- n := 0;
- p := 81;
- repeat
- n := n + 1;
- p := (p-1);
- until (rcv_buffer[buf_cnt]^[p] = ' ') OR
- (p = 0);
- p := p + 1;
- n := n - 1;
- if n in [1..10]
- then
- begin
- tmpstr := '';
- gotoxy(xin - n, yin);
- ClrEol;
- next_line;
- rcv_buffer[buf_cnt]^[0] := chr(81 - n);
- while (n > 0) do
- begin
- tmpstr := tmpstr + rcv_buffer[buf_cnt]^[p];
- write(rcv_buffer[buf_cnt]^[p]);
- inc(p);
- dec(n);
- inc(xin);
- end;
- update_buffer(#13);
- for i := 1 to length(tmpstr) do
- update_buffer(tmpstr[i]);
- end
- else
- begin
- next_line;
- update_buffer(#13);
- end;
- end;
- ' ' : begin
- next_line;
- update_buffer(#13);
- end;
- end;
- gotoxy(xin,yin);
- case st of
- #13 : begin
- update_buffer(#13);
- next_line;
- end;
- #10 : ;
- else begin
- write(st);
- xin := xin + 1;
- update_buffer(st);
- end;
- end;
- if (st = #32) AND (mode = CW)
- then begin
- rcv_stat;
- disp_rcv_wpm;
- end;
- end;
-
- var LastRcvChar : char;
-
- procedure rcvg;
- var ThisChar : char;
- begin
- if char_ready then
- begin
- ThisChar := kam_in;
- show_inp(ThisChar);
- if (mode = AMTOR) AND (LastRcvChar = '+') AND (ThisChar = '?')
- then state := transmit;
- LastRcvChar := ThisChar;
- end;
- end;
-
- procedure show_page(n : integer);
- var i,j : integer;
- begin
- window(1,inp_start_line,80,inp_end_line);
- clrscr;
- window(1,inp_start_line,80,inp_end_line + 1);
- gotoxy(1,1);
- if (buf_cnt > nlines) then
- for i := n to n + nlines - 1 do
- begin
- if buf_cnt > nlines then
- if ( i > buf_cnt)
- then j := i- buf_cnt
- else j := i;
- if (length(rcv_buffer[j]^) = 80)
- then write(rcv_buffer[j]^)
- else writeln(rcv_buffer[j]^);
- end
- else
- for i := 1 to buf_cnt do
- if (length(rcv_buffer[i]^) = 80)
- then write(rcv_buffer[i]^)
- else writeln(rcv_buffer[i]^);
- window(1,inp_start_line,80,inp_end_line);
- gotoxy(1,1);
- end;
-
- procedure scrollup;
- begin
- if (buf_cnt <= nlines) then exit;
- if ((first + nlines) = buf_cnt) then exit;
- window(1,inp_start_line,80,inp_end_line);
- gotoxy(1,1);
- DelLine;
- inc(first);
- window(1,inp_start_line,80,inp_end_line + 1);
- gotoxy(1,nlines);
- if (length(rcv_buffer[first+nlines]^) = 80)
- then write(rcv_buffer[first+nlines]^)
- else writeln(rcv_buffer[first+nlines]^);
- window(1,inp_start_line,80,inp_end_line);
- gotoxy(1,1);
- end;
-
- procedure scrolldwn;
- begin
- if (first = 1) then exit;
- window(1,inp_start_line,80,inp_end_line);
- gotoxy(1,1);
- InsLine;
- dec(first);
- gotoxy(1,1);
- writeln(rcv_buffer[first]^);
- gotoxy(1,1);
- end;
-
- procedure review_rcv_buffer;
- var i : integer;
- OldVideo : array[1..2000] of word;
- RevKey : char;
- begin
- nlines := inp_end_line - inp_start_line + 1;
- first := 1;
- if (buf_cnt = 0) AND (rcv_cnt = 0) then exit;
- FillPage(@OldVideo);
- gotoxy(1,status_line);
- status_color;
- ClrEol;
- write(' HOME start END end PGUP PGDWN Scroll Up Scroll Dwn ESC return ');
- receive_color;
- show_page(first);
- repeat
- repeat
- RevKey := readkey;
- until RevKey in [#0,#27];
- if RevKey = #0 then RevKey := readkey;
- case RevKey of
- #71 : begin { HOME }
- first := 1;
- show_page(first);
- end;
- #79 : begin { END }
- first := buf_cnt - nlines + 1;
- if first < 1 then first := 1;
- show_page(first);
- end;
- #73 : begin { PGUP }
- first := first + nlines;
- if (first >= buf_cnt) then first := buf_cnt - nlines + 1;
- show_page(first);
- end;
- #81 : begin { PGDWN }
- first := first - nlines;
- if (first < 1) then first := 1;
- show_page(first);
- end;
- #72 : scrollup;
- #80 : scrolldwn;
- end;
- until RevKey = #27;
- DisPlayPage(@OldVideo);
- window(1,1,80,25);
- end;
-